package org.app4j.passport;

import javax.sql.DataSource;

import org.apache.commons.dbcp.BasicDataSource;
import org.app4j.annotation.App;
import org.app4j.passport.dao.UserDao;
import org.app4j.passport.service.UserService;

import com.google.inject.AbstractModule;

/**
 * @author Chi
 */
@App(mapping = "passport", version = "1.0")
public class PassportModule extends AbstractModule {
  @Override
  protected void configure() {
    this.bind(UserDao.class);
    this.bind(UserService.class);

    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setUsername("root");
    dataSource.setPassword("ueQ5HaDNwcPNGm4Z");
    dataSource.setUrl("jdbc:mysql://localhost/www?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;failOverReadOnly=false");
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");

    this.bind(DataSource.class).toInstance(dataSource);

  }

}
